package com.lft.cryptology02.kaiser01;

public class KaiserDemo {
    public static void main(String[] args) {
        // 明文
        String str = "Hello World";
        
        // 移动位数
        int shift = 3;
        
        // 用于拼接
        StringBuilder builder = new StringBuilder();
        
        // 将字符串转换成字节数组
        char[] charArray = str.toCharArray();
        for (char c : charArray) {
            int ascii = c;
            // 移位加密
            ascii = ascii + shift;
            // 转成新字符
            char newChar = (char) ascii;
            // 拼接
            builder.append(newChar);
        }
        
        // 打印密文
        System.out.println(builder);
    }
}
